@extends('admin.layout.main')
@section('content')
    <!-- iCheck for checkboxes and radio inputs -->
    <link rel="stylesheet" href="{{asset('/adminlte/plugins/iCheck/all.css')}}">
    <section class="content-header">
      <h1>
        房卡分配日志
      </h1>
      <ol class="breadcrumb">
        <li><a href="javascript:void(0)"><i class="fa fa-dashboard"></i> 游戏代理</a></li>
      </ol>
    </section>
    <section class="content">
        <!-- Small boxes (Stat box) -->
        <div class="row">
            <div class="col-lg-12 col-xs-6">
                <div class="box">
                    <div class="box-header with-border">
                        <div class="row">
                            <div class="col-sm-10">

                            </div>
                        </div> 
                    </div>
                    
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-bordered table-hover" id="user-list">
                            <thead>
                                <tr>
                                    <th style="width: 50px"><a style="cursor:pointer" class="all_check">全选</a></th>
                                    <th>分配人</th>
                                    <th>接受人</th>
                                    <th>房卡数量</th>
                                    <th>分配时间</th>
                                </tr>
                            </thead>
                            <tbody> 
                                @foreach($logs as $log)
                                    <tr id="{{$log->id}}">
                                        <td>
                                            <input type="checkbox" name="checkbox_member" class="checkbox_member" user-id="{{$log->id}}">
                                        </td>
                                        <td>{{$log->sendName()}}</td>
                                        <td>{{$log->agentName($log->accept_id)}}@if($log->type == 2)(代理) @elseif($log->type == 3)(玩家)@endif</td>
                                        <td>{{$log->gems}}</td>
                                        <td>{{$log->created_at}}</td>
                                    </tr>
                                @endforeach
                            </tbody>
                        </table>
                        {{$logs->links()}}
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- datepicker -->
    <script src="{{asset('/adminlte/plugins/datepicker/bootstrap-datepicker.js')}}"></script>
    <!-- iCheck 1.0.1 -->
    <script src="{{asset('/adminlte/plugins/iCheck/icheck.min.js')}}"></script>
    <script type="text/javascript">
        $(function () {
            $('#user-list').DataTable({
              "paging": false,
              "lengthChange": false,
              "searching": false,
              "info": false,
              "autoWidth": true,
              "columns": [
                {"orderable": false},
                {"orderable": false},
                {"orderable": true},
                {"orderable": true},
                {"orderable": true}
              ]
            });
        });

        $('.all_check').click(function(){
            $('.checkbox_member').click();
        });

        $('#datepicker').datepicker({
          autoclose: true,
          endDate: new Date()
        });

        $('.group-edit').click(function(){
            var aid = $(this).parents('tr').attr('id');
            dialog_params('/admin/agent/audit/'+aid, '代理审核');
        });

    </script>
@endsection      